package com.xli.module.framemodule.entity.mapper;

import com.xli.module.framemodule.entity.dto.ModuleAddDTO;
import com.xli.module.framemodule.entity.dto.ModuleUpdateDTO;
import com.xli.module.framemodule.entity.vo.ModuleVO;
import com.xli.ui.module.framemodule.entity.FrameModule;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;


@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface IFrameModuleMapper {

    IFrameModuleMapper INSTANCE = Mappers.getMapper(IFrameModuleMapper.class);

    @Mappings({
            @Mapping(source = "isShow", target = "is_show"),
            @Mapping(source = "orderNum", target = "order_num")})
    FrameModule toEntity(ModuleAddDTO dto);

    @Mappings({
            @Mapping(source = "isShow", target = "is_show"),
            @Mapping(source = "orderNum", target = "order_num")})
    FrameModule toEntity(ModuleUpdateDTO dto);

    @Mappings({
            @Mapping(source = "is_show", target = "isShow"),
            @Mapping(source = "order_num", target = "orderNum")})
    ModuleVO toVO(FrameModule frameModule);
}
